package ltmm.server;

import spark.Request;
import spark.Response;
import spark.Route;

import java.util.function.Function;

public class RouteObjectFactory {
    private RouteObject routeObject;

    public RouteObject getRouteObject(String path, IRouteFuntion routeFuntion){
        Route route = new Route() {
            @Override
            public Object handle(Request request, Response response) throws Exception {
                return routeFuntion.handle(request,response);
            }
        };
        routeObject = new RouteObject(path,route);
        return routeObject;
    }
}
